﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ColumnList.aspx.cs" Inherits="Whir_System_Module_Role_ColumnList" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <script language="javascript" type="text/javascript">
        if (top.location == self.location) { 
            alert('禁止访问子栏目页！将跳转到默认页面');
            top.location='../../Default.aspx';
        } 
    </script>

    <link href="../../Skin/Default/Css/main.css" rel="stylesheet" type="text/css" />
    <!-- ExtJs-->
    <link rel="stylesheet" type="text/css" href="<%= ResolveUrl("../../Js/extjs2/resources/css/ext-all.css") %>" />
    <link rel="stylesheet" type="text/css" href="<%= ResolveUrl("../../Js/extjs2/resources/css/xtheme-gray.css") %>" />

    <script type="text/javascript" src="<%= ResolveUrl("../../Js/extjs2/adapter/ext/ext-base.js") %>"></script>

    <script type="text/javascript" language="javascript" src="<%= ResolveUrl("../../Js/extjs2/ext-all.js") %>"></script>

    <!--弹出窗体-->
    <link href="../../Js/JBox/jBox.css" type="text/css" rel="stylesheet" />

    <script src="../../Js/jquery/jquery1.3.11.pack.js" type="text/javascript"></script>

    <script src="../../Js/JBox/jBox-1.0.0.0.js" type="text/javascript"></script>

    <!--提示文字-->

    <script src="../../Js/common.js" type="text/javascript"></script>

    <script language="javascript">
        showhint('0','<b>如何修改栏目</b><br/>在下面菜单中，右键选择您需要修改的栏目节点，点击“编辑此栏目”进行下一步操作。<br/><b>如何删除栏目</b><br/>在下面菜单中，右键选择您需要修改的栏目节点，点击“删除此栏目”进行下一步操作。');
    </script>

    <style type="text/css">
    html { 
        overflow-x:hidden; /*隐藏水平滚动条*/ 
    } 
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <table>
            <tr>
                <td width="30%" valign="top">
                    <div id="tree-div" style="overflow: auto; height: 420px; border: 0px;">
                    </div>
                </td>
                <td width="70%" valign="top">
                    <input type="button" id="btnAdd" runat="server" class="btn_default" value="添加栏目"
                        onclick="jBox.open('iframe-jBoxID','iframe', 'AddColumn2.aspx?Action=Add', '添加栏目', 'width=680,height=450,center=true,minimizable=false,resize=false,draggable=false,model=true,scrolling=true');" />
                </td>
            </tr>
        </table>
    </form>
</body>
</html>

<script type="text/javascript" language="javascript">

var tree = null;
Ext.onReady(function(){

    Ext.BLANK_IMAGE_URL = "../../Js/extjs2/resources/images/default/s.gif"
    // shorthand
    var Tree = Ext.tree;
    
    tree = new Tree.TreePanel({
        el:'tree-div',
        autoScroll:true,
        animate:true,
        enableDD:false,
        containerScroll: true, 
        onlyLeafCheckable: false,
        loader: new Tree.TreeLoader({
            dataUrl:'getTreeData.aspx'            
        }),
        margins:'15,15,15,15',
        border:false        
    });

    // set the root node
    var root = new Tree.AsyncTreeNode({
        text: '栏目管理',
        draggable:false,
        id:'source'
    });
    tree.setRootNode(root);

//定义右键菜单
    var rightClick = new Ext.menu.Menu({
        id :'rightClickCont',
            items : [{
                id:'modifyItem',
                text:'编辑此栏目',
                handler:function(){
                    jBox.open('iframe-jBoxID','iframe', 'AddColumn2.aspx?Action=Modify&ColumnID='+selected.id, '修改栏目', 'width=680,height=450,center=true,minimizable=false,resize=false,draggable=false,model=true,scrolling=true');
                }                
           },{
                id:'deleteItem',
                text:'删除此栏目',
                handler:function(){
                    jBox.open('iframe-jBoxID','iframe', 'AddColumn2.aspx?Action=Delete&ColumnID='+selected.id, '删除栏目', 'width=680,height=450,center=true,minimizable=false,resize=false,draggable=false,model=true,scrolling=true');
                }  
           },{
               id:'EditModules',
               text:"当前栏目模板",
               handler:function (){
                   if(selected.leaf){
                        window.open("../../UserControls/Common/go.ashx?Action=EditModules&columnID=" + selected.id);
                   }else{
                        window.parent.alert("当前选中为根节点，请选择子节点");
                   }
               }
            }]
    });

    //增加右键点击事件
    tree.on('contextmenu',function(node,event){//声明菜单类型
        event.preventDefault();//关闭默认的菜单，以避免弹出两个菜单 
        node.select();//选中点击的节点 
        selected = new Ext.tree.TreeNode({ 
            id:node.id, 
            text:node.text,
            leaf:node.leaf
        });
        rightClick.showAt(event.getXY());//取得鼠标点击坐标，展示菜单
    });

    // render the tree
    tree.render();
    root.expand();
});

</script>

